<?php
/**
 * User - пользователь системы
 * 
 * @author Mazvv
 * @package Extenders
 */
class User {
	private $a_userRid;
	private $a_userPositionRid;
	private $a_userFullName;
	private $a_userFilialRid;
	private $ciObject;
	
	/**
	 * 
	 * @author Mazvv
	 * @param void
	 */
	public function __construct(){
		$this->ciObject = &get_instance();
		$this->ciObject->load->model('user_model');
	}
	
	/**
	 * 
	 * 
	 * @author Mazvv
	 * @param void
	 * @return void
	 */
	public function InitUser(){
		$p_userSessionData = $this->ciObject->session->userdata('AUTH');
		if(!$p_userSessionData) return;
		$this->a_userRid = $p_userSessionData['userRID'];
		$this->a_userPositionRid = $p_userSessionData['userPositionRID'];
		$this->a_userFilialRid = $p_userSessionData['userFilialRID'];
		$this->a_userFullName = $this->ciObject->user_model->GetUserFullName($this->a_userRid);
		$this->ciObject->load->library('menucontainer', $this->a_userPositionRid);
		return;
	}
	
	/**
	 * 
	 * 
	 * @author Mazvv
	 * @param void
	 * @return fullName
	 */
	public function GetFullName(){
		return $this->a_userFullName;
	}
	
	/**
	 * 
	 * 
	 * @author Mazvv
	 * @param $p_newPasswd
	 * @return boolean
	 */
	public function ChangeUserPasswd($p_newPasswd){
		return $this->ciObject->user_model->ChangeUserPasswd($this->a_userRid, $p_newPasswd);
	}
	
	/**
	 * 
	 * 
	 * @author Mazvv
	 * @param void
	 * @return void
	 */
	public function UpdateUserData(){
		$this->InitUser();
	}
	
	/**
	 * 
	 * 
	 * @author Mazvv
	 * @param void 
	 * @return filialRid
	 */
	public function GetFilialRid() {
		return $this->a_userFilialRid;
	}
	
	/**
	 * 
	 * 
	 * @author Mazvv
	 * @param void 
	 * @return filialRid
	 */
	public function GetUserRid() {
		return $this->a_userRid;
	}
	
	public function GetUserEmpRid(){
		return $this->ciObject->user_model->GetUserEmpRid($this->a_userRid);	
	}
}
?>